package com.kexun.utils;

public class Result {
    private static final long serialVersionUID = 1L;

    private int code;

    private String msg;

    private Object data;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result() {
    }

    public static Result success() {
        return new Result(0, "ok", null);
    }

    public static Result success(String msg) {
        return new Result(0, msg, null);
    }

    public static Result success(String msg, Object data) {
        return new Result(0, msg, data);
    }


    public static Result error() {
        return new Result(500, "error", null);
    }

    public static Result error(String msg) {
        return new Result(500, msg, null);
    }

    public static Result error(String msg, Object data) {
        return new Result(500, msg, data);
    }


}
